function sendMsg() {
  var code = document.all ? window.event.keyCode : arguments.callee.caller.arguments[0].which;

  if (code == "13" || code == "1") //enter键
  {
    var text = document.getElementById('input_box');
    var chat = document.getElementById('chatbox');
    var btn = document.getElementById('send');
    var talk = document.getElementById('talkbox');
    var username = document.getElementById('username');
    if (text.value == '') {
      alert('不能发送空消息');
    } else {
      chat.innerHTML += '<li class="me"><img src="' + 'images/own_head.jpg' + '"><span>' + text.value + '</span></li>';
      text.value = '';
      chat.scrollTop = chat.scrollHeight;
      talk.style.background = "#fff";
      text.style.background = "#fff";
      bot.sendMsg(text.value, username)
        .catch(err => {
          bot.emit('error', err)
        })
    };
  }
}

function userlistClick(nickname, username) {
  document.getElementById('cur_nickname').innerText = nickname
  document.getElementById('username').value = username
}
